package String;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * @description:
 * @author: cyy
 **/
public class string_method {
    public static void main(String[] args) {

        //substring
        //beginIndex 包括
        //endInddex  不包括
        //System.out.println("shitutuya:"+"4102".substring(0,4));



        //split
       /* String msg="100|84|0|91|100|100|99|100|0|0|100";
        String[] split = msg.split("\\|");
        for (int i=0;i<split.length;i++){
            System.out.println("shitutuya:"+split[i]);
        }*/
        String[] split1 = "".split("");
        String[] split2 = "0,1,2,3".split(",");
        System.out.println("字符串长度"+ split1.length + "=========字符串长度" +split2.length);


        //字符串相加测试
     /* String a1=null;
        String a=a1+"lovetutuya";
        System.out.println("shitutuya:"+a);*/

        //字符串转换为2进制
       /* String xx=Integer.toBinaryString(16);
        List<Integer> list=new ArrayList<>();
        for(int i=0;i<xx.length();i++){
            char c = xx.charAt(i);
            if(c == 1){
            }
            list.add((int) xx.charAt(i));
            Collections.reverse(list);
            System.out.println("shitutuya1:"+list.size());
        }
        System.out.println("shitutuya:"+xx);*/


        //字符串替换及indexof
        String xx="000100";
        String xx1=xx.replaceAll("0","");
        if( xx1.length() ==1){
            System.out.println("shitutuya:"+xx+"==="+xx.indexOf("1"));
        }

        //集合的size 0二进制的长度 1
        /*System.out.println("size:"+new ArrayList<>().size());

        String tableItem=Integer.toBinaryString(0);
        String valueReplace =tableItem.replaceAll("0","");
        System.out.println("length:"+valueReplace.length()+"===length2:"+tableItem.length());*/


      /*  String[] a= {""};
        if(a[0].equals("")){
            System.out.println("shitutuya:==="+a[0]);
        }else {
            System.out.println("shitutuya:");
        }*/

//        System.out.println("shitutuya:"+"".matches("[0-9]+"));
//        List<String> a=new ArrayList<>();


//        String cyy = "123";
//        String cyy1 = "123,456";
//        String[] split = cyy.split(",");
//        String[] split2 = cyy1.split(",");
//        System.out.println("result:" + cyy);

//        System.out.println("result:" + String.valueOf(Timestamp.valueOf("2021-12-01 12:00:00").getTime())) ;
//        System.out.println("result1:" + System.currentTimeMillis()) ;

//        String[] split = "a,".split(",");
//        System.out.println("result:" + split.length);
//        System.out.println("result:" + "".substring(0, "".length()));

//        JSONArray J1 = new JSONArray();
//        JSONObject jinja = new JSONObject();
//        jinja.put("result", "1123");
//        jinja.put("result1", "11232");
//        J1.add(jinja);
//        System.out.println("shuuju："+J1.toString() + "长度：" +J1.toString().length());
//        System.out.println( "https://ptacbeidou.oss-cn-shenzhen.aliyuncs.com/img/home/swiper1.jpg".length());



//        System.out.println("经度校验：" + isLONG("132"));
//        System.out.println("纬度校验：" + isLA("20.1"));
//        System.out.println(".号校验："  + Pattern.matches("\\.", ","));
        String str = null;
        System.out.println("result::" + "str".equals(str));

        String a = "{\"bannerArr1\":{\"isNum\":1,\"imgPath\":\"/serverapi/profile/upload/2022/10/22/首页轮播图1_20221022152236A001.jpg\",\"router\":\"goods\",\"typeDictionaryId\":1,\"spuId\":6,\"buttonPosition\":\"right\",\"buttonColor\":\"black\",\"videoManagementId\":\"\",\"seriesDictionaryId\":2},\"bannerArr2\":{\"isNum\":2,\"imgPath\":\"/serverapi/profile/upload/2022/10/22/首页轮播图2_20221022152238A002.jpg\",\"router\":\"newsVideoDetail\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"bannerArr3\":{\"isNum\":3,\"imgPath\":\"/serverapi/profile/upload/2022/10/22/首页轮播图3_20221022152240A003.jpg\",\"router\":\"goods\",\"typeDictionaryId\":1,\"spuId\":3,\"buttonPosition\":\"right\",\"buttonColor\":\"black\",\"videoManagementId\":\"\",\"seriesDictionaryId\":1},\"bannerArr4\":{\"isNum\":4,\"imgPath\":\"/serverapi/profile/upload/2022/10/22/首页轮播图4_20221022152242A004.jpg\",\"router\":\"photography\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"centerBottom\",\"buttonColor\":\"white\",\"videoManagementId\":\"\"},\"bannerArr5\":{\"isNum\":5,\"imgPath\":\"/serverapi/profile/upload/2022/10/24/shexiangtou_20221024174110A046.png\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"frontId\":2,\"status\":\"2\"}";
        System.out.println("长度：" + a.length());
        System.out.println("{\"bannerArr1\":{\"isNum\":1,\"imgPath\":\"/serverapi/profile/upload/2022/10/17/微信图片_20221011114536_20221017224906A001.png\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"bannerArr2\":{\"isNum\":2,\"imgPath\":\"/serverapi/profile/upload/2022/10/20/9PRO-bg_20221020141214A003.png\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"bannerArr3\":{\"isNum\":3,\"imgPath\":\"/serverapi/profile/upload/2022/10/17/微信图片_202210111145361_20221017224918A002.png\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"bannerArr4\":{\"isNum\":4,\"imgPath\":\"/serverapi/profile/upload/2022/10/17/蕾蕾最新课表_20221017224951A003.png\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"bannerArr5\":{\"isNum\":5,\"imgPath\":\"\",\"router\":\"\",\"typeDictionaryId\":\"\",\"spuId\":\"\",\"buttonPosition\":\"\",\"buttonColor\":\"\",\"videoManagementId\":\"\"},\"frontId\":12}".length());
    }

    /**
     * 经度校验
     *
     * @param value
     * @return
     */
//    private static boolean isLONG(String value) {
//        String regExpress = "^(\\-|\\+)?(((\\d|[1-9]\\d|1[0-7]\\d|0{1,3})\\.\\d{1,6})|180\\.0{1,6}|0\\.\\d{1,6})$";
//        return Pattern.matches(regExpress, value);
//    }

    /**
     * 维度校验
     *
     * @param value
     * @return
     */
//    private static  boolean isLA(String value) {
//        String regExpress = "^(\\-|\\+)?([1-8]?\\d{1}\\.\\d{1,6}|90\\.0{1,6}|0\\.\\d{1,6})$";
//        return Pattern.matches(regExpress, value);
//    }



}
